﻿/*
版权所有：版权所有(C) 2011，刘建新
文件编号：M01_DownloadFile.cs
文件名称：DownloadFile.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2011/1/6
作　　者：
内容摘要：表[DownLoad_File]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.DownLoadMgnt
{
		/// <summary>
		/// 类 编 号：
		/// 类 名 称：DownloadFile
		/// 内容摘要：
		/// </summary>
		
		[Serializable]
		public class DownloadFile : BaseModel
		{
		#region 自动生成代码
		
			#region 重载Equals/GetHashCode
			/// <summary>
			/// 重载Equals			
			/// </summary>
			public override bool Equals (Object obj)
			{
				if (obj != null && obj is DownloadFile)
				{
					if (obj == this)
						return true;
					DownloadFile castObj = (DownloadFile)obj; 
					
					if (!this.m_DownloadFileId.Equals(castObj.DownloadFileId))
						return false;
						
					if (!this.m_Title.Equals(castObj.Title))
						return false;
						
					if (!this.m_ClassType.Equals(castObj.ClassType))
						return false;
						
					if (!this.m_Code.Equals(castObj.Code))
						return false;
						
					if (!this.m_ShowIdx.Equals(castObj.ShowIdx))
						return false;
						
					if (!this.m_FileLogo.Equals(castObj.FileLogo))
						return false;
						
					if (!this.m_ViewTimes.Equals(castObj.ViewTimes))
						return false;
						
					if (!this.m_DownloadTimes.Equals(castObj.DownloadTimes))
						return false;
						
					if (!this.m_Createby.Equals(castObj.Createby))
						return false;
						
					if (!this.m_Createdate.Equals(castObj.Createdate))
						return false;
						
					if (!this.m_Brief.Equals(castObj.Brief))
						return false;
						
					if (!this.m_Content.Equals(castObj.Content))
						return false;
						
					if (!this.m_FilePath1.Equals(castObj.FilePath1))
						return false;
						
					if (!this.m_FileName1.Equals(castObj.FileName1))
						return false;
						
					if (!this.m_FilePath2.Equals(castObj.FilePath2))
						return false;
						
					if (!this.m_FileName2.Equals(castObj.FileName2))
						return false;
						
					if (!this.m_FilePath3.Equals(castObj.FilePath3))
						return false;
						
					if (!this.m_FileName3.Equals(castObj.FileName3))
						return false;
						
					return true;
				}
				return false;
			}
			
			/// <summary>
			/// 重载GetHashCode
			/// </summary>
			public override int GetHashCode()
			{
					int hash = 0;					
					
					hash = hash <<  8;
					if ((object)m_DownloadFileId != null)
					{
						hash = hash ^ m_DownloadFileId.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Title != null)
					{
						hash = hash ^ m_Title.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ClassType != null)
					{
						hash = hash ^ m_ClassType.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Code != null)
					{
						hash = hash ^ m_Code.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ShowIdx != null)
					{
						hash = hash ^ m_ShowIdx.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FileLogo != null)
					{
						hash = hash ^ m_FileLogo.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_ViewTimes != null)
					{
						hash = hash ^ m_ViewTimes.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_DownloadTimes != null)
					{
						hash = hash ^ m_DownloadTimes.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createby != null)
					{
						hash = hash ^ m_Createby.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createdate != null)
					{
						hash = hash ^ m_Createdate.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Brief != null)
					{
						hash = hash ^ m_Brief.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Content != null)
					{
						hash = hash ^ m_Content.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FilePath1 != null)
					{
						hash = hash ^ m_FilePath1.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FileName1 != null)
					{
						hash = hash ^ m_FileName1.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FilePath2 != null)
					{
						hash = hash ^ m_FilePath2.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FileName2 != null)
					{
						hash = hash ^ m_FileName2.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FilePath3 != null)
					{
						hash = hash ^ m_FilePath3.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_FileName3 != null)
					{
						hash = hash ^ m_FileName3.GetHashCode();
					}
						
					return hash; 
			}
			#endregion
			
			public DownloadFile()
			{
				MarkNew();
			}						
			
			public DownloadFile GetOldValue()
			{
				return OldValue as DownloadFile;
			}
		
		#region DownloadFileId属性
			private int m_DownloadFileId = 0;
			/// <summary>
			/// 属性名称： DownloadFileId
			/// 内容摘要： DB列名：DownLoad_File_ID[]
			///            DB类型：int
			/// </summary>
			public int DownloadFileId
			{
				get
					{
						return m_DownloadFileId;
					}
				set
					{
						if (m_DownloadFileId as object == null || !m_DownloadFileId.Equals(value))
						{
							m_DownloadFileId = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Title属性
			private string m_Title = String.Empty;
			/// <summary>
			/// 属性名称： Title
			/// 内容摘要： DB列名：Title[下载文章标题]
			///            DB类型：string
			/// </summary>
			public string Title
			{
				get
					{
						return m_Title;
					}
				set
					{
						if (m_Title as object == null || !m_Title.Equals(value))
						{
							m_Title = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ClassType属性
			private string m_ClassType = String.Empty;
			/// <summary>
			/// 属性名称： ClassType
			/// 内容摘要： DB列名：Class_Type[文件类型]
			///            DB类型：string
			/// </summary>
			public string ClassType
			{
				get
					{
						return m_ClassType;
					}
				set
					{
						if (m_ClassType as object == null || !m_ClassType.Equals(value))
						{
							m_ClassType = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Code属性
			private string m_Code = String.Empty;
			/// <summary>
			/// 属性名称： Code
			/// 内容摘要： DB列名：Code[编码(可限下载类型,目前可以不支持多级)]
			///            DB类型：string
			/// </summary>
			public string Code
			{
				get
					{
						return m_Code;
					}
				set
					{
						if (m_Code as object == null || !m_Code.Equals(value))
						{
							m_Code = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ShowIdx属性
			private int m_ShowIdx = 0;
			/// <summary>
			/// 属性名称： ShowIdx
			/// 内容摘要： DB列名：Show_Idx[显示顺序(大的排前)]
			///            DB类型：int
			/// </summary>
			public int ShowIdx
			{
				get
					{
						return m_ShowIdx;
					}
				set
					{
						if (m_ShowIdx as object == null || !m_ShowIdx.Equals(value))
						{
							m_ShowIdx = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FileLogo属性
			private string m_FileLogo = String.Empty;
			/// <summary>
			/// 属性名称： FileLogo
            /// 内容摘要： DB列名：File_Logo[下载文件显示logo图片（固定在/UploadFile/|Createby|/Img/|File_Logo|）]
			///            DB类型：string
			/// </summary>
			public string FileLogo
			{
				get
					{
						return m_FileLogo;
					}
				set
					{
						if (m_FileLogo as object == null || !m_FileLogo.Equals(value))
						{
							m_FileLogo = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region ViewTimes属性
			private int m_ViewTimes = 0;
			/// <summary>
			/// 属性名称： ViewTimes
			/// 内容摘要： DB列名：View_Times[查看次数]
			///            DB类型：int
			/// </summary>
			public int ViewTimes
			{
				get
					{
						return m_ViewTimes;
					}
				set
					{
						if (m_ViewTimes as object == null || !m_ViewTimes.Equals(value))
						{
							m_ViewTimes = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region DownloadTimes属性
			private int m_DownloadTimes = 0;
			/// <summary>
			/// 属性名称： DownloadTimes
			/// 内容摘要： DB列名：DownLoad_Times[下载次数]
			///            DB类型：int
			/// </summary>
			public int DownloadTimes
			{
				get
					{
						return m_DownloadTimes;
					}
				set
					{
						if (m_DownloadTimes as object == null || !m_DownloadTimes.Equals(value))
						{
							m_DownloadTimes = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createby属性
			private string m_Createby = String.Empty;
			/// <summary>
			/// 属性名称： Createby
			/// 内容摘要： DB列名：Createby[创建人]
			///            DB类型：string
			/// </summary>
			public string Createby
			{
				get
					{
						return m_Createby;
					}
				set
					{
						if (m_Createby as object == null || !m_Createby.Equals(value))
						{
							m_Createby = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createdate属性
			private DateTime m_Createdate = new DateTime(1900,1,1);
			/// <summary>
			/// 属性名称： Createdate
			/// 内容摘要： DB列名：Createdate[创建时间]
			///            DB类型：DateTime
			/// </summary>
			public DateTime Createdate
			{
				get
					{
						return DateTime.Parse(m_Createdate.ToString("yyyy-MM-dd HH:mm:ss"));
					}
				set
					{
						if (m_Createdate as object == null || !m_Createdate.Equals(value))
						{
							m_Createdate = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Brief属性
			private string m_Brief = String.Empty;
			/// <summary>
			/// 属性名称： Brief
			/// 内容摘要： DB列名：Brief[简介]
			///            DB类型：string
			/// </summary>
			public string Brief
			{
				get
					{
						return m_Brief;
					}
				set
					{
						if (m_Brief as object == null || !m_Brief.Equals(value))
						{
							m_Brief = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Content属性
			private string m_Content = String.Empty;
			/// <summary>
			/// 属性名称： Content
			/// 内容摘要： DB列名：Content[详细内容]
			///            DB类型：string
			/// </summary>
			public string Content
			{
				get
					{
						return m_Content;
					}
				set
					{
						if (m_Content as object == null || !m_Content.Equals(value))
						{
							m_Content = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FilePath1属性
			private string m_FilePath1 = String.Empty;
			/// <summary>
			/// 属性名称： FilePath1
			/// 内容摘要： DB列名：File_path1[文件地址1（固定在/UploadFile/|Createby|/File/|File_path1|）]
			///            DB类型：string
			/// </summary>
			public string FilePath1
			{
				get
					{
						return m_FilePath1;
					}
				set
					{
						if (m_FilePath1 as object == null || !m_FilePath1.Equals(value))
						{
							m_FilePath1 = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FileName1属性
			private string m_FileName1 = String.Empty;
			/// <summary>
			/// 属性名称： FileName1
			/// 内容摘要： DB列名：File_name1[文件名1]
			///            DB类型：string
			/// </summary>
			public string FileName1
			{
				get
					{
						return m_FileName1;
					}
				set
					{
						if (m_FileName1 as object == null || !m_FileName1.Equals(value))
						{
							m_FileName1 = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FilePath2属性
			private string m_FilePath2 = String.Empty;
			/// <summary>
			/// 属性名称： FilePath2
			/// 内容摘要： DB列名：File_path2[文件地址2（固定在/UploadFile/|Createby|/File/|File_path1|）]
			///            DB类型：string
			/// </summary>
			public string FilePath2
			{
				get
					{
						return m_FilePath2;
					}
				set
					{
						if (m_FilePath2 as object == null || !m_FilePath2.Equals(value))
						{
							m_FilePath2 = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FileName2属性
			private string m_FileName2 = String.Empty;
			/// <summary>
			/// 属性名称： FileName2
			/// 内容摘要： DB列名：File_name2[文件名2]
			///            DB类型：string
			/// </summary>
			public string FileName2
			{
				get
					{
						return m_FileName2;
					}
				set
					{
						if (m_FileName2 as object == null || !m_FileName2.Equals(value))
						{
							m_FileName2 = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FilePath3属性
			private string m_FilePath3 = String.Empty;
			/// <summary>
			/// 属性名称： FilePath3
			/// 内容摘要： DB列名：File_path3[文件地址3（固定在/UploadFile/|Createby|/File/|File_path1|）]
			///            DB类型：string
			/// </summary>
			public string FilePath3
			{
				get
					{
						return m_FilePath3;
					}
				set
					{
						if (m_FilePath3 as object == null || !m_FilePath3.Equals(value))
						{
							m_FilePath3 = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region FileName3属性
			private string m_FileName3 = String.Empty;
			/// <summary>
			/// 属性名称： FileName3
			/// 内容摘要： DB列名：File_name3[文件名3]
			///            DB类型：string
			/// </summary>
			public string FileName3
			{
				get
					{
						return m_FileName3;
					}
				set
					{
						if (m_FileName3 as object == null || !m_FileName3.Equals(value))
						{
							m_FileName3 = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="tableName">表名</param>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(string tableName,ColumnNameEnum cne)
			{
				DataTable dtResult = new DataTable(tableName);
			
				if (cne == ColumnNameEnum.DBName)
				{
					dtResult.Columns.Add(new DataColumn("DownLoad_File_ID",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Title",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Class_Type",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Code",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Show_Idx",typeof(int)));
					dtResult.Columns.Add(new DataColumn("File_Logo",typeof(string)));
					dtResult.Columns.Add(new DataColumn("View_Times",typeof(int)));
					dtResult.Columns.Add(new DataColumn("DownLoad_Times",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Createby",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createdate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("Brief",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Content",typeof(string)));
					dtResult.Columns.Add(new DataColumn("File_path1",typeof(string)));
					dtResult.Columns.Add(new DataColumn("File_name1",typeof(string)));
					dtResult.Columns.Add(new DataColumn("File_path2",typeof(string)));
					dtResult.Columns.Add(new DataColumn("File_name2",typeof(string)));
					dtResult.Columns.Add(new DataColumn("File_path3",typeof(string)));
					dtResult.Columns.Add(new DataColumn("File_name3",typeof(string)));
				}
				else if (cne == ColumnNameEnum.PropertyName)
				{
					dtResult.Columns.Add(new DataColumn("DownloadFileId",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Title",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ClassType",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Code",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ShowIdx",typeof(int)));
					dtResult.Columns.Add(new DataColumn("FileLogo",typeof(string)));
					dtResult.Columns.Add(new DataColumn("ViewTimes",typeof(int)));
					dtResult.Columns.Add(new DataColumn("DownloadTimes",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Createby",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createdate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("Brief",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Content",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FilePath1",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FileName1",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FilePath2",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FileName2",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FilePath3",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FileName3",typeof(string)));
				}
				return dtResult;
			}
			
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(ColumnNameEnum cne)
			{
				return CreateDataTable(null,cne);
			}

			/// <summary>
			/// 得到实体对应的DataTable(默认列名映射为属性名)
			/// </summary>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable()
			{
				return CreateDataTable(ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			public void FillDataRow(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				if (ColumnNameEnum.DBName == cne)
				{
					dr["DownLoad_File_ID"] = this.DownloadFileId;
					dr["Title"] = this.Title;
					dr["Class_Type"] = this.ClassType;
					dr["Code"] = this.Code;
					dr["Show_Idx"] = this.ShowIdx;
					dr["File_Logo"] = this.FileLogo;
					dr["View_Times"] = this.ViewTimes;
					dr["DownLoad_Times"] = this.DownloadTimes;
					dr["Createby"] = this.Createby;
					dr["Createdate"] = this.Createdate;
					dr["Brief"] = this.Brief;
					dr["Content"] = this.Content;
					dr["File_path1"] = this.FilePath1;
					dr["File_name1"] = this.FileName1;
					dr["File_path2"] = this.FilePath2;
					dr["File_name2"] = this.FileName2;
					dr["File_path3"] = this.FilePath3;
					dr["File_name3"] = this.FileName3;
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					dr["DownLoad_File_ID"] = this.DownloadFileId;
					dr["Title"] = this.Title;
					dr["Class_Type"] = this.ClassType;
					dr["Code"] = this.Code;
					dr["Show_Idx"] = this.ShowIdx;
					dr["FileLogo"] = this.FileLogo;
					dr["View_Times"] = this.ViewTimes;
					dr["DownLoad_Times"] = this.DownloadTimes;
					dr["Createby"] = this.Createby;
					dr["Createdate"] = this.Createdate;
					dr["Brief"] = this.Brief;
					dr["Content"] = this.Content;
					dr["FilePath1"] = this.FilePath1;
					dr["FileName1"] = this.FileName1;
					dr["FilePath2"] = this.FilePath2;
					dr["FileName2"] = this.FileName2;
					dr["FilePath3"] = this.FilePath3;
					dr["FileName3"] = this.FileName3;					
				}
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow(默认列名映射为属性名)
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			public void FillDataRow(DataRow dr)
			{
				this.FillDataRow(dr,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 将DataRow转换成DownloadFile对象
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			/// <returns>DownloadFile对象</returns>
			public static DownloadFile Dr2Obj(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				DownloadFile obj = new DownloadFile();
				if (ColumnNameEnum.DBName == cne)
				{
					obj.DownloadFileId = (dr["DownLoad_File_ID"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["DownLoad_File_ID"],typeof(int));
					obj.Title = (dr["Title"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Title"],typeof(string));
					obj.ClassType = (dr["Class_Type"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Class_Type"],typeof(string));
					obj.Code = (dr["Code"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Code"],typeof(string));
					obj.ShowIdx = (dr["Show_Idx"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Show_Idx"],typeof(int));
					obj.FileLogo = (dr["File_Logo"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_Logo"],typeof(string));
					obj.ViewTimes = (dr["View_Times"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["View_Times"],typeof(int));
					obj.DownloadTimes = (dr["DownLoad_Times"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["DownLoad_Times"],typeof(int));
					obj.Createby = (dr["Createby"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Createby"],typeof(string));
					obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["Createdate"],typeof(DateTime));
					obj.Brief = (dr["Brief"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Brief"],typeof(string));
					obj.Content = (dr["Content"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Content"],typeof(string));
					obj.FilePath1 = (dr["File_path1"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_path1"],typeof(string));
					obj.FileName1 = (dr["File_name1"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_name1"],typeof(string));
					obj.FilePath2 = (dr["File_path2"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_path2"],typeof(string));
					obj.FileName2 = (dr["File_name2"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_name2"],typeof(string));
					obj.FilePath3 = (dr["File_path3"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_path3"],typeof(string));
					obj.FileName3 = (dr["File_name3"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_name3"],typeof(string));
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					obj.DownloadFileId = (dr["DownLoad_File_ID"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["DownLoad_File_ID"],typeof(int));
					obj.Title = (dr["Title"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Title"],typeof(string));
					obj.ClassType = (dr["Class_Type"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Class_Type"],typeof(string));
					obj.Code = (dr["Code"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Code"],typeof(string));
					obj.ShowIdx = (dr["Show_Idx"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Show_Idx"],typeof(int));
					obj.FileLogo = (dr["FileLogo"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["FileLogo"],typeof(string));
					obj.ViewTimes = (dr["View_Times"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["View_Times"],typeof(int));
					obj.DownloadTimes = (dr["DownLoad_Times"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["DownLoad_Times"],typeof(int));
					obj.Createby = (dr["Createby"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Createby"],typeof(string));
					obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["Createdate"],typeof(DateTime));
					obj.Brief = (dr["Brief"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Brief"],typeof(string));
					obj.Content = (dr["Content"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Content"],typeof(string));
					obj.FilePath1 = (dr["File_path1"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_path1"],typeof(string));
					obj.FileName1 = (dr["File_name1"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_name1"],typeof(string));
					obj.FilePath2 = (dr["File_path2"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_path2"],typeof(string));
					obj.FileName2 = (dr["File_name2"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_name2"],typeof(string));
					obj.FilePath3 = (dr["File_path3"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_path3"],typeof(string));
					obj.FileName3 = (dr["File_name3"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["File_name3"],typeof(string));		
				}
				
				return obj;
			}
			
			/// <summary>
			/// 将DataRow转换成DownloadFile对象(默认列名映射为属性名)
			/// </summary>
			/// <returns>DownloadFile对象</returns>
			public static DownloadFile Dr2Obj(DataRow dr)
			{
				return Dr2Obj(dr,ColumnNameEnum.DBName);
			}
			
			/// <summary>
			/// 将DataTabe转换成的DownloadFile对象集合
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			/// <returns>DownloadFile对象的集合</returns>
			public static IList Dt2Objs(DataTable dt,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				
				ArrayList alResult = new ArrayList();
				
				foreach(DataRow dr in dt.Rows)
				{
					alResult.Add(Dr2Obj(dr,cne));
				}
				
				return alResult;
			}

			/// <summary>
			/// 将DataTabe转换成的DownloadFile对象集合(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <returns>DownloadFile对象的集合</returns>
			public static IList Dt2Objs(DataTable dt)
			{
				return Dt2Objs(dt,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用objs的DownloadFile对象集合填充DataTable
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">DownloadFile对象集合</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			public static void FillDataTable(DataTable dt,IList objs,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				if (objs == null)
				{
					throw new ArgumentNullException("objs");
				}
				
				foreach(DownloadFile obj in objs)
				{
					DataRow dr = dt.NewRow();
					obj.FillDataRow(dr,cne);
					dt.Rows.Add(dr);
				}
			}

			/// <summary>
			/// 用objs的DownloadFile对象集合填充DataTable(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">DownloadFile对象集合</param>
			public static void FillDataTable(DataTable dt,IList objs)
			{
				FillDataTable(dt,objs,ColumnNameEnum.PropertyName);
			}
		#endregion
		
		/// <summary>
		/// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
		/// </summary>
		public override void CancelEdit()
		{
			DownloadFile old = this.OldValue as DownloadFile;
			if (old != null)
			{
					this.DownloadFileId = old.DownloadFileId;
					this.Title = old.Title;
					this.ClassType = old.ClassType;
					this.Code = old.Code;
					this.ShowIdx = old.ShowIdx;
					this.FileLogo = old.FileLogo;
					this.ViewTimes = old.ViewTimes;
					this.DownloadTimes = old.DownloadTimes;
					this.Createby = old.Createby;
					this.Createdate = old.Createdate;
					this.Brief = old.Brief;
					this.Content = old.Content;
					this.FilePath1 = old.FilePath1;
					this.FileName1 = old.FileName1;
					this.FilePath2 = old.FilePath2;
					this.FileName2 = old.FileName2;
					this.FilePath3 = old.FilePath3;
					this.FileName3 = old.FileName3;				
				this.OldValue = null;
			}
		}
		
		
		
		
		#region DownloadFile实体的内部Key类
			/// <summary>
			/// DownloadFile实体的Key类
			/// </summary>
			public sealed class Key
			{
		
				private int m_DownloadFileId;
				public int DownloadFileId
				{
 					get 
					{ 
						 return m_DownloadFileId; 
					}
					set 
					{ 
						m_DownloadFileId = value;
					}
				}
		
				public Key(int pDownloadFileId)
				{
					m_DownloadFileId=pDownloadFileId;

				}
			}
		#endregion
			/// <summary>
			/// 得到实体DownloadFile的PK
			/// </summary>
			public Key GetKey()
			{
				return new Key(DownloadFileId);				
			}
			
				
		#endregion
	}
}
